class House:
    def __init__(self, house_type, house_area):
        """
        初始化房子
        """
        self.house_type = house_type
        self.area = house_area
        self.furniture = []
        self.free_area = self.area
        # for f in self.furniture:

    def show_house(self):
        """
        打印房子信息：户型、面积、家具
        """
        print(f'户型：{self.house_type}\n总面积：{self.area} ———— 剩余面积：{self.free_area}\n家具列表：')
        for f in self.furniture:
            print(f'{f.name},{f.area}')

    def add_furniture(self, *args):
        """
        添加家具
        """
        for f in args:
            if self.free_area - f.area >= 0:
                self.furniture.append(f)
                self.free_area -= f.area
            else:
                print(f'添加{f.name}失败，空间不足')


class Furniture:
    def __init__(self, name, area):
        self.name = name
        self.area = area


if __name__ == '__main__':
    bed = Furniture('bed', 4)
    wardrobe = Furniture('wardrobe', 2)
    table = Furniture('table', 1.5)
    swimming_pool = Furniture('swimming_pool', 900)
    big_house = House('三层海景大别墅', 800)
    big_house.add_furniture(bed, wardrobe, table)
    # big_house.show_house()
    big_house.add_furniture(swimming_pool)
    big_house.show_house()
